package open.tech.dawn.rest.common.log.factory;


import open.tech.dawn.rest.common.log.enums.LogSucceed;
import open.tech.dawn.rest.common.log.enums.LogType;
import open.tech.dawn.rest.module.system.model.SysLoginLog;

import java.util.Date;

/**
 * 日志对象创建工厂
 */
public class LogFactory {


    /**
     * 创建登录日志
     */
    public static SysLoginLog createLoginLog(LogType logType, String userId, String msg, String ip) {
        SysLoginLog loginLog = new SysLoginLog();
        loginLog.setLogname(logType.getMessage());
        loginLog.setUserid(userId);
        loginLog.setCreatetime(new Date());
        loginLog.setSucceed(LogSucceed.SUCCESS.getMessage());
        loginLog.setIp(ip);
        loginLog.setMessage(msg);
        return loginLog;
    }
}
